package us.danlib.templating;

/**
 * The template interface to be used with the
 *  Templator class
 * 
 * @author Daniel
 *
 */
public interface Template {

	/**
	 * Parse a global variable
	 * 
	 * @param varName
	 * @param varValue
	 */
	public void addGlobalVar(String varName, String varValue);

	/**
	 * Add a class element (used for lists); "vars" should
	 *  be an array with the i'th element as the var name and the
	 *  i+1'th element being that var's value
	 *  
	 * @param className
	 * @param vars
	 */
	public void addClass(String className, String... vars);
	
	/**
	 * Begin adding a class element; Use this in conjunction
	 *  with {@link #addClassVar(String, String)}) and {@link #endClass()}
	 *  if you have vars that may or not be added in a particular class
	 *  
	 * @param className
	 */
	public void beginClass(String className);
	
	/**
	 * Add a single class var to the class element currently
	 *  being added 
	 * @see #addClass(String, String...)
	 * @see #beginClass(String)
	 * 
	 * @param varName
	 * @param varValue
	 */
	public void addClassVar(String varName, String varValue);
	
	/**
	 * Finalize the class element currently being added
	 * @see #beginClass(String)
	 * @see #addClass(String, String...)
	 */
	public void endClass();
	
	/**
	 * Do any final work and return the filled-out template 
	 *  in string form
	 *  
	 * @return The filled-out template
	 */
	public String render();

	/**
	 * Check if the template has the specified variable defined
	 * 
	 * @param varName
	 * @return
	 */
	public boolean hasTemplateVar(String varName);

	/**
	 * Get the value of the template variable
	 * 
	 * @param varName
	 * @return
	 */
	public String getTemplateVar(String varName);
}
